package ${package.ServiceImpl};


<#if table.serviceInterface>
    import ${package.Service}.${table.serviceName};
</#if>
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;

@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}Entity>()<#if table.serviceInterface>, ${table.serviceName}</#if> {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}Entity><#if table.serviceInterface> implements ${table.serviceName}</#if> {
public QueryWrapper<${entity}> getQueryWrapper(Map<String, Object> params) {
QueryWrapper<${entity}> shopQueryWrapper = new QueryWrapper<>();
        String userId = (String) params.get("userId");
        shopQueryWrapper.like(!StringUtils.isEmpty(userId), "user_id", userId);
return shopQueryWrapper;
}

@Override
public PageData<${entity}DTO> Page(Map<String , Object> params) {
    QueryWrapper<${entity}> queryWrapper = getQueryWrapper(params);
    String page1 = (String) params.get("currentPage");
    String size = (String) params.get("pageSize");
    Page<${entity}> page = new Page<>(Integer.parseInt(page1), Integer.parseInt(size));
    Page<${entity}> pageInfo = super.page(page, queryWrapper);
    List<${entity}DTO> liveDTOS = JSONUtils.listParse(pageInfo.getRecords(), ${entity}DTO.class);
        return new PageData<>(liveDTOS, pageInfo.getTotal());
        }

        @Override
        public Result Add(${entity}DTO dto) {
        ${entity}Entity liveEntity = JSONUtils.objParse(dto, ${entity}Entity.class);
        boolean save = save(liveEntity);
        if (save) {
        return new Result().ok();
        }
        return new Result().err(501);
        }

        @Override
        public Result UpdateInfo(${entity}DTO dto) {
        UpdateWrapper<${entity}Entity> wrapper = new UpdateWrapper<>();
        wrapper
        .eq("id", dto.getId());
        boolean update = update(wrapper);
        if (update) {
        return new Result().ok();
        }
        return new Result().err(501);
        }
        }
        </#if>
